//
//  OuptPatientInfoViewController.m
//  掌上宏力
//
//  Created by admin on 2017/5/11.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "OuptPatientInfoViewController.h"
#import "OutPatientViewController.h"
#import "OuptPrescListViewController.h"
#import "CheckInfoViewController.h"
#import "TestInfoViewController.h"
#import "OutPatientInfoViewModel.h"


@interface OuptPatientInfoViewController ()

@property (nonatomic,strong) OutPatientInfoViewModel *viewModel;

@end

@implementation OuptPatientInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"门诊信息";
}

-(void)getDatasArray{
    [self getDatasArray:^(GetDatas handler) {
        _viewModel = [[OutPatientInfoViewModel alloc] init];
        [_viewModel getOutPatientViewList:^{
            handler(_viewModel.datasArray);
        }];
    }];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellId = @"cellId";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = _viewModel.datasArray[indexPath.section];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    switch (indexPath.section) {
        case 0:{
            //就诊记录
            OutPatientViewController *outPatient = [[OutPatientViewController alloc] init];
            [self pushViewControllerTo:outPatient];
        }
            break;
        case 1:{
            //处方记录
            OuptPrescListViewController *prescListVC = [[OuptPrescListViewController alloc] init];
            [self pushViewControllerTo:prescListVC];
        }
            break;
        case 2:{
            //检查信息
            CheckInfoViewController *checkVC = [[CheckInfoViewController alloc] init];
            checkVC.title = @"门诊检查记录";
            checkVC.patientSource = @"1";
            [self pushViewControllerTo:checkVC];
        }
            break;
        case 3:{
            //检验信息
            TestInfoViewController *testInfo = [[TestInfoViewController alloc] init];
            testInfo.title = @"门诊检验记录";
            [self pushViewControllerTo:testInfo];
        }
            break;
        default:
            break;
    }
}


@end
